<template>
<div>
    <el-switch
    style="display: block"
    v-model="value"
    active-color="#13ce66"
    inactive-color="#ff4949"
    active-text="启用"
    inactive-text="禁用"
    active-value="y"
    inactive-value="n"
    @change="changeStatus"
    :disabled="mydisabled"
  >
  </el-switch>
</div>
</template>

<script>
export default {
  props: ["status","mydisabled"],
  data() {
    return {
      value: this.status,
    };
  },
  watch: {
    status:function(newvalue,oldvalue){
      this.value = newvalue
    }
  },
  methods: {
    changeStatus(){
      this.$emit('changeStatus', this.value);
    }
  }
};
</script>